
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>启动网络脚本配置剖析 · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="gitbook/images/favicon.ico" type="image/x-icon">

    
    
    <link rel="prev" href="chap2.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="./">
            
                <a href="./">
            
                    
                    介绍
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" >
            
                <span>
            
                    
                    编译部署
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="chap1.html">
            
                <a href="chap1.html">
            
                    
                    编译与测试网络部署
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="chap2.html">
            
                <a href="chap2.html">
            
                    
                    网络生成配置说明
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.2.3" data-path="chap3.html">
            
                <a href="chap3.html">
            
                    
                    启动网络脚本配置剖析
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" >
            
                <span>
            
                    
                    通道实践
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="chap4.html">
            
                <a href="chap4.html">
            
                    
                    创建加入通道
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="chap5.html">
            
                <a href="chap5.html">
            
                    
                    更新通道配置
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="chap6.html">
            
                <a href="chap6.html">
            
                    
                    动态添加组织
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" >
            
                <span>
            
                    
                    合约实践
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="chap7.html">
            
                <a href="chap7.html">
            
                    
                    安装发布智能合约
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="chap8.html">
            
                <a href="chap8.html">
            
                    
                    升级智能合约
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="chap9.html">
            
                <a href="chap9.html">
            
                    
                    智能合约设置背书策略
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4" data-path="chap10.html">
            
                <a href="chap10.html">
            
                    
                    调试go智能合约
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.5" data-path="chap11.html">
            
                <a href="chap11.html">
            
                    
                    外部构建启动合约
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" >
            
                <span>
            
                    
                    SDK实践
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="chap12.html">
            
                <a href="chap12.html">
            
                    
                    基于Java SDK实现合约交易
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="." >启动网络脚本配置剖析</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <p>&#x4E0A;&#x4E00;&#x7AE0;&#x53EF;&#x77E5;fabric&#x7F51;&#x7EDC;&#x542F;&#x52A8;&#x4E3B;&#x8981;&#x4F9D;&#x8D56;&#x811A;&#x672C;<code>./byfn.sh up</code>
&#x63A5;&#x4E0B;&#x9488;&#x5BF9;&#x8FD9;&#x4E2A;&#x811A;&#x672C;&#x8FDB;&#x884C;&#x5256;&#x6790;&#xFF0C;&#x7814;&#x7A76;fabric2.0 first-network&#x7684;&#x542F;&#x52A8;&#x8FC7;&#x7A0B;&#x3002;</p>
<h2 id="1byfnsh">1.byfn.sh</h2>
<p>&#x67E5;&#x770B;byfn.sh&#x627E;&#x5230;up&#x6A21;&#x5F0F;&#x4E3B;&#x8981;&#x505A;&#x4E86;&#x4EC0;&#x4E48;&#xFF0C;&#x5982;&#x4E0B;&#x56FE;&#x53EF;&#x89C1;&#xFF0C;&#x6267;&#x884C;networkUp&#x8FD9;&#x4E2A;function&#x6765;&#x5B9E;&#x73B0;fabric&#x7F51;&#x7EDC;&#x542F;&#x52A8;&#x3002;</p>
<p><img src="https://img-blog.csdnimg.cn/20200213163814266.png" alt="&#x5728;&#x8FD9;&#x91CC;&#x63D2;&#x5165;&#x56FE;&#x7247;&#x63CF;&#x8FF0;"></p>
<p>&#x63A5;&#x4E0B;&#x6765;&#x8FDB;&#x5165;networkUp&#x8BE6;&#x7EC6;&#x9605;&#x8BFB;&#xFF1A;
<img src="https://img-blog.csdnimg.cn/20200213163946763.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzI4NTQwNDQz,size_16,color_FFFFFF,t_70" alt="&#x5728;&#x8FD9;&#x91CC;&#x63D2;&#x5165;&#x56FE;&#x7247;&#x63CF;&#x8FF0;">
networkUp&#x8FD9;&#x4E2A;function&#x91CC;&#x9762;&#x6838;&#x5FC3;&#x811A;&#x672C;&#x4E3B;&#x8981;&#x4E3A;&#x4EE5;&#x4E0A;&#x7EA2;&#x8272;&#x6846;&#x4F4F;&#x7684;&#x90E8;&#x5206;&#xFF0C;&#x5206;&#x522B;&#x4E3A;&#xFF1A;</p>
<pre><code>1. &#x68C0;&#x67E5;&#x4E8C;&#x8FDB;&#x5236;&#x6587;&#x4EF6;&#x662F;&#x5426;&#x53EF;&#x7528;&#x4EE5;&#x53CA;&#x5BF9;&#x5E94;&#x7248;&#x672C;docker&#x955C;&#x50CF;&#x662F;&#x5426;&#x5B58;&#x5728;&#x3002;
2. &#x5047;&#x5982;&#x5F53;&#x524D;sh&#x6240;&#x5728;&#x7236;&#x76EE;&#x5F55;&#x4E0D;&#x5B58;&#x5728;crypto-config&#x76EE;&#x5F55;&#x5C31;&#x6267;&#x884C;&#x751F;&#x6210;&#x533A;&#x5757;&#x3001;&#x901A;&#x9053;&#x4EE5;&#x53CA;&#x8BC1;&#x4E66;&#x811A;&#x672C;&#xFF0C;&#x8BE6;&#x60C5;&#x8BF7;&#x67E5;&#x770B;[Fabric2.0 first-network &#x751F;&#x6210;&#x914D;&#x7F6E;&#x8BF4;&#x660E;](https://blog.csdn.net/qq_28540443/article/details/104282768)
3. &#x4F7F;&#x7528;docker-compose&#x547D;&#x4EE4;&#x542F;&#x52A8;fabric&#x7F51;&#x7EDC;&#x3002;
4. &#x52A0;&#x8F7D;go&#x5408;&#x7EA6;&#x4F9D;&#x8D56;&#x5305;
5. &#x4F7F;&#x7528;cli&#x5BA2;&#x6237;&#x7AEF;&#x6267;&#x884C;&#x811A;&#x672C;&#x64CD;&#x4F5C;

     &#x5176;&#x4E2D;&#x5728;&#x9ED8;&#x8BA4;&#x6761;&#x4EF6;&#x4E0B;&#x542F;&#x52A8;yaml&#x6587;&#x4EF6;&#x5305;&#x62EC;&#xFF1A;
     docker-compose-cli.yaml
     docker-compose-etcdraft2.yaml
</code></pre><h2 id="2docker-compose-cliyaml">2.docker-compose-cli.yaml</h2>
<p>&#x4E3A;&#x4E86;&#x770B;&#x6E05;&#x695A;docker-compose-cli.yaml&#x5177;&#x4F53;&#x542F;&#x52A8;&#x4E86;&#x4EC0;&#x4E48;&#xFF0C;&#x6211;&#x4EEC;&#x5C06;&#x6587;&#x4EF6;&#x62C6;&#x5206;&#x6267;&#x884C;
&#x9996;&#x5148;&#x6253;&#x5F00;&#x63A7;&#x5236;&#x53F0;&#xFF0C;&#x8F93;&#x5165;&#x4EE5;&#x4E0B;&#x547D;&#x4EE4;</p>
<pre><code class="lang-bash"><span class="hljs-built_in">cd</span> first-network
docker-compose <span class="hljs-_">-f</span> docker-compose-cli.yaml up <span class="hljs-_">-d</span> 2&gt;&amp;1
</code></pre>
<p>&#x6267;&#x884C;&#x7ED3;&#x679C;&#x5982;&#x4E0B;&#x56FE;&#x6240;&#x793A;&#xFF1A;
<img src="https://img-blog.csdnimg.cn/20200213164756714.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzI4NTQwNDQz,size_16,color_FFFFFF,t_70" alt="&#x5728;&#x8FD9;&#x91CC;&#x63D2;&#x5165;&#x56FE;&#x7247;&#x63CF;&#x8FF0;">
    &#x603B;&#x5171;&#x542F;&#x52A8;&#x4E86;6&#x4E2A;&#x5BB9;&#x5668;&#x5206;&#x522B;&#x662F;&#xFF1A;</p>
<p>   5&#x4E2A;&#x6392;&#x5E8F;&#x8282;&#x70B9;&#x4E2D;&#x7684;&#x5176;&#x4E2D;&#x4E00;&#x4E2A;&#x8282;&#x70B9;</p>
<pre><code> orderer.example.com
</code></pre><p>  &#x4E24;&#x4E2A;&#x7EC4;&#x7EC7;org1&#x3001;org2&#x7684;&#x8282;&#x70B9; </p>
<pre><code> peer0.org1.example.com**
 peer1.org1.example.com**
 peer0.org2.example.com**
 peer1.org2.example.com**
</code></pre><p>fabric&#x5BA2;&#x6237;&#x7AEF;</p>
<pre><code> cli    
</code></pre><h3 id="21-&#x6392;&#x5E8F;&#x8282;&#x70B9;&#x542F;&#x52A8;">2.1 &#x6392;&#x5E8F;&#x8282;&#x70B9;&#x542F;&#x52A8;</h3>
<p>orderer.example.com
       &#x4ECE;&#x6392;&#x5E8F;&#x8282;&#x70B9;&#x5165;&#x624B;&#xFF1A;
    &#x4E00;&#x822C;&#x6765;&#x8BF4;&#xFF0C;&#x6211;&#x4F1A;&#x4ECE;&#x542F;&#x52A8;&#x65E5;&#x5FD7;&#x5165;&#x624B;&#xFF0C;&#x5148;&#x770B;&#x7ED3;&#x679C;&#x518D;&#x770B;&#x914D;&#x7F6E;&#xFF0C;&#x6253;&#x5F00;&#x63A7;&#x5236;&#x53F0;&#xFF0C;&#x8F93;&#x5165;&#x4EE5;&#x4E0B;&#x547D;&#x4EE4;</p>
<pre><code class="lang-bash">docker logs <span class="hljs-_">-f</span> orderer.example.com --tail=300
</code></pre>
<p>&#x63A7;&#x5236;&#x53F0;&#x8F93;&#x51FA;&#x4E86;orderer.example.com&#x7684;&#x542F;&#x52A8;&#x65E5;&#x5FD7;&#x5982;&#x4E0B;</p>
<p>&#x7531;&#x4E8E;&#x592A;&#x957F;&#x6211;&#x5206;&#x5F00;&#x51E0;&#x4E2A;&#x90E8;&#x5206;&#x6765;&#x8BF4;</p>
<p>&#xFF08;1&#xFF09;&#x6392;&#x5E8F;&#x8282;&#x70B9;&#x914D;&#x7F6E;&#x9879;&#x8F93;&#x51FA;&#xFF1A;
&#x6392;&#x5E8F;&#x8282;&#x70B9;&#x542F;&#x52A8;&#x7684;&#x65F6;&#x5019;&#xFF0C;&#x4F1A;&#x6839;&#x636E;&#x73AF;&#x5883;&#x53D8;&#x91CF;&#x8F93;&#x51FA;&#x76F8;&#x5E94;&#x7684;&#x914D;&#x7F6E;&#xFF0C;&#x5305;&#x62EC;&#x8BC1;&#x4E66;&#x914D;&#x7F6E;&#x3001;&#x76D1;&#x542C;&#x7AEF;&#x53E3;&#x914D;&#x7F6E;&#x7B49;&#xFF0C;
<img src="https://img-blog.csdnimg.cn/20200213165359148.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzI4NTQwNDQz,size_16,color_FFFFFF,t_70" alt="&#x5728;&#x8FD9;&#x91CC;&#x63D2;&#x5165;&#x56FE;&#x7247;&#x63CF;&#x8FF0;">
&#x800C;&#x8FD9;&#x4E9B;&#x914D;&#x7F6E;&#x5BF9;&#x5E94;&#x5C31;&#x662F;docker-compose-cli.yaml&#x7684;&#x4EE5;&#x4E0B;&#x914D;&#x7F6E;&#xFF1A;
<img src="https://img-blog.csdnimg.cn/20200213165424524.png" alt="&#x5728;&#x8FD9;&#x91CC;&#x63D2;&#x5165;&#x56FE;&#x7247;&#x63CF;&#x8FF0;">
    &#x6211;&#x4EEC;&#x7EE7;&#x7EED;&#x8FFD;&#x8E2A;base/docker-compose-base.yaml&#xFF0C;&#x627E;&#x5230;orderer.example.com&#x670D;&#x52A1;</p>
<p><img src="https://img-blog.csdnimg.cn/20200213165456781.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzI4NTQwNDQz,size_16,color_FFFFFF,t_70" alt="&#x5728;&#x8FD9;&#x91CC;&#x63D2;&#x5165;&#x56FE;&#x7247;&#x63CF;&#x8FF0;">
        &#x4ECE;&#x4E0A;&#x56FE;&#x6765;&#x770B;&#xFF0C;orderer&#x7684;&#x914D;&#x7F6E;&#x8FD8;&#x662F;&#x5F15;&#x5165;peer-base.yaml&#x4E2D;&#x7684;orderer-base&#x670D;&#x52A1;</p>
<p><img src="https://img-blog.csdnimg.cn/20200213165510237.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzI4NTQwNDQz,size_16,color_FFFFFF,t_70" alt="&#x5728;&#x8FD9;&#x91CC;&#x63D2;&#x5165;&#x56FE;&#x7247;&#x63CF;&#x8FF0;"></p>
<p>&#x4ECE;&#x4E0A;&#x56FE;&#x6765;&#x770B;&#x4E0E;&#x65E5;&#x5FD7;&#x8F93;&#x51FA;&#x914D;&#x7F6E;&#x5339;&#x914D;&#xFF0C;&#x5C31;&#x662F;yaml&#x91CC;&#x9762;&#x52A0;&#x4E86;ORDERER_&#x524D;&#x7F00;&#xFF0C;&#x5176;&#x4F59;&#x914D;&#x7F6E;&#x7684;&#x4FEE;&#x6539;&#x4E5F;&#x53EF;&#x901A;&#x8FC7;&#x8FD9;&#x79CD;&#x65B9;&#x5F0F;&#x3002;&#x8BE6;&#x7EC6;&#x6392;&#x5E8F;&#x8282;&#x70B9;&#x914D;&#x7F6E;&#x8BF4;&#x660E;&#xFF0C;&#x665A;&#x70B9;&#x8865;&#x5145;&#x3002;</p>
<p>&#xFF08;2&#xFF09;&#x52A0;&#x8F7D;&#x521B;&#x59CB;&#x533A;&#x5757;&#xFF0C;&#x542F;&#x52A8;&#x6392;&#x5E8F;&#x8282;&#x70B9;&#x3002;
<img src="https://img-blog.csdnimg.cn/20200213165546881.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzI4NTQwNDQz,size_16,color_FFFFFF,t_70" alt="&#x5728;&#x8FD9;&#x91CC;&#x63D2;&#x5165;&#x56FE;&#x7247;&#x63CF;&#x8FF0;">
    &#x597D;&#x7684;&#x7CFB;&#x7EDF;&#x7684;&#x4E00;&#x4E2A;&#x597D;&#x7684;&#x65E5;&#x5FD7;&#x8F93;&#x51FA;&#xFF0C;fabric&#x7684;&#x65E5;&#x5FD7;&#x8F93;&#x51FA;&#x8FD8;&#x662F;&#x5F88;&#x4F18;&#x79C0;&#x7684;&#xFF0C;&#x4ECE;&#x65E5;&#x5FD7;&#x8F93;&#x51FA;&#x53EF;&#x4EE5;&#x8DDF;&#x8E2A;&#x6392;&#x5E8F;&#x8282;&#x70B9;&#x542F;&#x52A8;&#x7A76;&#x7ADF;&#x5E72;&#x4E86;&#x4EC0;&#x4E48;&#xFF0C;&#x901A;&#x8FC7;&#x4E0A;&#x56FE;&#x65E5;&#x5FD7;&#x8F93;&#x51FA;&#xFF0C;&#x53EF;&#x4EE5;&#x8BFB;&#x5230;&#xFF1A;</p>
<pre><code>1.&#x6839;&#x636E;1&#x7684;&#x914D;&#x7F6E;&#x521D;&#x59CB;&#x5316;&#x6392;&#x5E8F;&#x8282;&#x70B9;
2. &#x521B;&#x5EFA;&#x672C;&#x5730;&#x8D26;&#x672C;&#x76EE;&#x5F55;
3. &#x8BBE;&#x7F6E;&#x6392;&#x5E8F;&#x8282;&#x70B9;&#x670D;&#x52A1;&#x76D1;&#x542C;&#x7AEF;&#x53E3;
4. &#x6839;&#x636E;&#x521B;&#x59CB;&#x533A;&#x5757;&#x6587;&#x4EF6;&#x521D;&#x59CB;&#x5316;&#x672C;&#x5730;&#x8D26;&#x672C;
5. &#x542F;&#x52A8;fabric&#x7CFB;&#x7EDF;&#x901A;&#x9053;
6. &#x542F;&#x52A8;raft&#x670D;&#x52A1;
</code></pre><p>&#xFF08;3&#xFF09;raft&#x670D;&#x52A1;&#x542F;&#x52A8;
<img src="https://img-blog.csdnimg.cn/20200213165916906.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzI4NTQwNDQz,size_16,color_FFFFFF,t_70" alt="&#x5728;&#x8FD9;&#x91CC;&#x63D2;&#x5165;&#x56FE;&#x7247;&#x63CF;&#x8FF0;">
    &#x4E0A;&#x56FE;&#x5DF2;&#x7ECF;&#x6807;&#x8BC6;&#x4E86;&#x6838;&#x5FC3;&#x65E5;&#x5FD7;&#x5E76;&#x4E14;&#x8FDB;&#x884C;&#x8BF4;&#x660E;&#xFF0C;&#x6709;&#x4E00;&#x70B9;&#x8FD8;&#x662F;&#x5F88;&#x6E05;&#x6670;&#x7684;&#x5C31;&#x662F;&#xFF0C;(&#x5BF9;&#x4E8E;&#x6CA1;&#x4ED4;&#x7EC6;&#x7814;&#x7A76;fabric2.0 raft&#x7684;&#x4EBA;&#x6765;&#x8BF4;)&#x4E00;&#x4E2A;&#x901A;&#x9053;&#x5C31;&#x662F;&#x4E00;&#x4E2A;raft&#x670D;&#x52A1;&#x96C6;&#x7FA4;&#x3002;&#x7EA2;&#x8272;&#x7684;&#x65E5;&#x5FD7;&#x662F;&#x9519;&#x8BEF;&#xFF0C;&#x5728;&#x5206;&#x914D;&#x5B8C;raft&#x96C6;&#x7FA4;&#x8282;&#x70B9;&#x540E;&#xFF0C;&#x5176;&#x4F59;&#x8282;&#x70B9;&#x6CA1;&#x542F;&#x52A8;&#xFF0C;&#x6240;&#x4EE5;&#x90FD;&#x662F;&#x5931;&#x8D25;&#x7684;&#xFF0C;&#x540E;&#x9762;&#x4E00;&#x76F4;&#x5728;&#x505A;&#x91CD;&#x8FDE;&#x64CD;&#x4F5C;&#x3002;</p>
<p>&#x4EE5;&#x4E0A;&#x5C31;&#x662F;orderer.example.com&#x542F;&#x52A8;&#x5256;&#x6790;&#x8FC7;&#x7A0B;&#x3002;</p>
<h3 id="22-&#x8282;&#x70B9;&#x542F;&#x52A8;">2.2 &#x8282;&#x70B9;&#x542F;&#x52A8;</h3>
<p>&#x7136;&#x540E;&#x6211;&#x4EEC;&#x6765;&#x770B;&#x4EE5;&#x4E0B;peer0.org1.example.com
&#x6253;&#x5F00;&#x63A7;&#x5236;&#x53F0;&#xFF0C;&#x8F93;&#x5165;&#x4EE5;&#x4E0B;&#x547D;&#x4EE4;</p>
<pre><code class="lang-bash">docker logs <span class="hljs-_">-f</span> peer0.org1.example.com --tail=300
</code></pre>
<p>&#x63A7;&#x5236;&#x53F0;&#x8F93;&#x51FA;&#x7ED3;&#x679C;&#x5982;&#x4E0B;&#xFF1A;
<img src="https://img-blog.csdnimg.cn/20200213170230304.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzI4NTQwNDQz,size_16,color_FFFFFF,t_70" alt="&#x5728;&#x8FD9;&#x91CC;&#x63D2;&#x5165;&#x56FE;&#x7247;&#x63CF;&#x8FF0;">
    peer&#x8282;&#x70B9;&#x542F;&#x52A8;&#x4E3B;&#x8981;&#x662F;</p>
<pre><code> 1. &#x542F;&#x52A8;peer grpc&#x670D;&#x52A1;
2. &#x521D;&#x59CB;&#x5316;gossip&#x670D;&#x52A1;
3. &#x521D;&#x59CB;&#x5316;&#x672C;&#x5730;&#x8D26;&#x672C;
4. &#x5B89;&#x88C5;&#x7CFB;&#x7EDF;&#x94FE;&#x7801;,&#x8FD9;&#x91CC;&#x6BD4;&#x8D77;1.x&#xFF0C;2.0&#x591A;&#x4E86;&#x4E00;&#x4E2A;&#x7CFB;&#x7EDF;&#x94FE;&#x7801;&#x5C31;&#x662F;_lifecycle&#xFF0C;&#x662F;&#x8DDF;&#x667A;&#x80FD;&#x5408;&#x7EA6;&#x76F8;&#x5173;&#x7684;&#x94FE;&#x7801;&#xFF0C;&#x6211;&#x4EEC;&#x4E0B;&#x4E00;&#x7BC7;&#x8FDB;&#x884C;&#x8BE6;&#x89E3;&#x3002;
5. &#x57FA;&#x4E8E;gossip&#x5BF9;&#x540C;&#x7EC4;&#x7EC7;&#x8282;&#x70B9;&#x8FDB;&#x884C;&#x4EA4;&#x4E92;
</code></pre><h2 id="3docker-compose-etcdraft2yaml">3.docker-compose-etcdraft2.yaml</h2>
<p>&#x540C;&#x6837;&#x7684;&#x5957;&#x8DEF;&#xFF0C;&#x9996;&#x5148;&#x6253;&#x5F00;&#x63A7;&#x5236;&#x53F0;&#xFF0C;&#x8F93;&#x5165;&#x4EE5;&#x4E0B;&#x547D;&#x4EE4;&#xFF1A;</p>
<pre><code class="lang-bash"><span class="hljs-built_in">cd</span> first-network
docker-compose <span class="hljs-_">-f</span> docker-compose-etcdraft2.yaml up <span class="hljs-_">-d</span> 2&gt;&amp;1
</code></pre>
<p>&#x63A7;&#x5236;&#x53F0;&#x8F93;&#x51FA;&#x7ED3;&#x679C;&#x5982;&#x4E0B;&#xFF1A;
<img src="https://img-blog.csdnimg.cn/2020021317041874.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzI4NTQwNDQz,size_16,color_FFFFFF,t_70" alt="&#x5728;&#x8FD9;&#x91CC;&#x63D2;&#x5165;&#x56FE;&#x7247;&#x63CF;&#x8FF0;">
&#x7531;&#x4E0A;&#x56FE;&#x53EF;&#x77E5;&#xFF0C;&#x4E3B;&#x8981;&#x542F;&#x52A8;&#x4E86;&#x5176;&#x4F59;4&#x4E2A;&#x6392;&#x5E8F;&#x8282;&#x70B9;</p>
<p>&#x5148;&#x4E0D;&#x770B;&#x65B0;&#x542F;&#x52A8;&#x7684;&#x6392;&#x5E8F;&#x8282;&#x70B9;&#xFF0C;&#x67E5;&#x770B;&#x539F;&#x672C;&#x5F00;&#x59CB;&#x542F;&#x52A8;&#x7684;orderer.example.com
&#x63A7;&#x5236;&#x53F0;&#x8F93;&#x5165;&#x4EE5;&#x4E0B;&#x547D;&#x4EE4;</p>
<pre><code class="lang-bash"> docker logs --tail=300  <span class="hljs-_">-f</span> orderer.example.com
</code></pre>
<p>&#x63A7;&#x5236;&#x53F0;&#x8F93;&#x51FA;&#x7ED3;&#x679C;&#x5982;&#x4E0B;&#xFF1A;
<img src="https://img-blog.csdnimg.cn/20200213170445619.png" alt="&#x5728;&#x8FD9;&#x91CC;&#x63D2;&#x5165;&#x56FE;&#x7247;&#x63CF;&#x8FF0;">
&#x7531;&#x65E5;&#x5FD7;&#x53EF;&#x4EE5;&#x89C2;&#x5BDF;&#x5230;&#xFF0C;orderer.example.com&#x4EE5;&#x53CA;&#x6210;&#x529F;&#x8FDE;&#x63A5;&#x5176;&#x4ED6;raft&#x8282;&#x70B9;&#xFF0C;<strong>&#x5E76;&#x4E14;&#x5728;raft &#x7684;term2 leader &#x4ECE;orderer.example.com (0)&#x53D8;&#x6210;orderer5.example.com&#xFF08;5&#xFF09;</strong></p>
<p>&#x63A5;&#x4E0B;&#x6765;&#x6211;&#x4EEC;&#x770B;&#x4E00;&#x4E0B;orderer5.example.com&#x8282;&#x70B9;&#x7684;&#x60C5;&#x51B5;
&#x63A7;&#x5236;&#x53F0;&#x8F93;&#x5165;&#x4EE5;&#x4E0B;&#x547D;&#x4EE4;&#xFF1A; </p>
<pre><code class="lang-bash">docker logs --tail=300  <span class="hljs-_">-f</span> orderer5.example.com
</code></pre>
<p>&#x63A7;&#x5236;&#x53F0;&#x8F93;&#x51FA;&#xFF1A;
<img src="https://img-blog.csdnimg.cn/20200213170538727.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzI4NTQwNDQz,size_16,color_FFFFFF,t_70" alt="&#x5728;&#x8FD9;&#x91CC;&#x63D2;&#x5165;&#x56FE;&#x7247;&#x63CF;&#x8FF0;">
&#x7531;&#x65E5;&#x5FD7;&#x53EF;&#x89C1;&#xFF0C;&#x5728;term2 &#x7ECF;&#x8FC7;&#x4E00;&#x8F6E;&#x6295;&#x7968;&#x540E;&#xFF0C;orderer5&#x83B7;&#x5F97;5&#x7968;&#x56DE;&#x5E94;&#x6210;&#x4E3A;&#x4E86;term2&#x7684;raft leader&#x3002;
&#x6574;&#x4F53;&#x7F51;&#x7EDC;&#x5904;&#x4E8E;&#x5B8C;&#x5168;&#x542F;&#x52A8;&#x72B6;&#x6001;&#x3002;</p>
<p><img src="https://img-blog.csdnimg.cn/20200213170655345.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzI4NTQwNDQz,size_16,color_FFFFFF,t_70" alt="&#x5728;&#x8FD9;&#x91CC;&#x63D2;&#x5165;&#x56FE;&#x7247;&#x63CF;&#x8FF0;"></p>
<h2 id="4&#x603B;&#x7ED3;">4.&#x603B;&#x7ED3;</h2>
<p>&#x4E0A;&#x9762;&#x662F;&#x5BF9;&#x7F51;&#x7EDC;&#x542F;&#x52A8;&#x7684;&#x811A;&#x672C;&#x4EE5;&#x53CA;&#x914D;&#x7F6E;&#x5256;&#x6790;&#xFF0C;&#x867D;&#x7136;&#x6BD4;&#x8F83;&#x7B80;&#x5355;&#xFF0C;&#x4F46;&#x662F;&#x4E3B;&#x8981;&#x662F;&#x5C55;&#x793A;&#x6574;&#x4E2A;&#x5B66;&#x4E60;&#x7684;&#x8FC7;&#x7A0B;&#xFF0C;&#x4E00;&#x4E9B;&#x6BD4;&#x8F83;&#x8BE6;&#x7EC6;&#x7684;&#x914D;&#x7F6E;&#x8BF4;&#x660E;&#x8FD8;&#x662F;&#x4ECE;&#x5B98;&#x65B9;&#x6587;&#x6863;&#x5B66;&#x4E60;&#x6BD4;&#x8F83;&#x597D;&#xFF0C;&#x901A;&#x8FC7;&#x4E0A;&#x9762;&#x7684;&#x5B66;&#x4E60;&#xFF0C;&#x4E5F;&#x53EF;&#x4EE5;&#x770B;&#x5230;fabric2.0&#x7684;&#x4E00;&#x4E9B;&#x65B0;&#x7279;&#x6027;&#xFF0C;&#x4E3B;&#x8981;&#x96C6;&#x4E2D;&#x5728;&#x667A;&#x80FD;&#x5408;&#x7EA6;&#x4EE5;&#x53CA;raft&#x5171;&#x8BC6;&#xFF0C;&#x540E;&#x9762;&#x5C06;&#x7EE7;&#x7EED;&#x5F80;&#x8FD9;&#x4E2A;&#x65B9;&#x5411;&#x8FDB;&#x884C;&#x7814;&#x7A76;&#x3002;</p>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="chap2.html" class="navigation navigation-prev navigation-unique" aria-label="Previous page: 网络生成配置说明">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"启动网络脚本配置剖析","level":"1.2.3","depth":2,"next":{"title":"通道实践","level":"1.3","depth":1,"ref":"","articles":[{"title":"创建加入通道","level":"1.3.1","depth":2,"path":"chap4.md","ref":"chap4.md","articles":[]},{"title":"更新通道配置","level":"1.3.2","depth":2,"path":"chap5.md","ref":"chap5.md","articles":[]},{"title":"动态添加组织","level":"1.3.3","depth":2,"path":"chap6.md","ref":"chap6.md","articles":[]}]},"previous":{"title":"网络生成配置说明","level":"1.2.2","depth":2,"path":"chap2.md","ref":"chap2.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":[],"pluginsConfig":{"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"chap3.md","mtime":"2020-03-12T03:45:19.058Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-03-12T04:26:38.647Z"},"basePath":".","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="gitbook/gitbook.js"></script>
    <script src="gitbook/theme.js"></script>
    
        
        <script src="gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

